package com.res.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="teacher")
public class Teacher {
@Id
private Integer tid;//老师编号
private String sex;//性别
private String tname;//老师姓名
private Integer age;//年龄
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="did")
private Department department;
public Integer getTid() {
	return tid;
}
public void setTid(Integer tid) {
	this.tid = tid;
}
public String getSex() {
	return sex;
}
public void setSex(String sex) {
	this.sex = sex;
}
public String getTname() {
	return tname;
}
public void setTname(String tname) {
	this.tname = tname;
}
public Integer getAge() {
	return age;
}
public void setAge(Integer age) {
	this.age = age;
}
public Department getDepartment() {
	return department;
}
public void setDepartment(Department department) {
	this.department = department;
}
@Override
public String toString() {
	return "Teacher [tid=" + tid + ", sex=" + sex + ", tname=" + tname + ", age=" + age + ", department=" + department
			+ "]";
}
public Teacher(Integer tid, String sex, String tname, Integer age, Department department) {
	super();
	this.tid = tid;
	this.sex = sex;
	this.tname = tname;
	this.age = age;
	this.department = department;
}
public Teacher() {
	super();
	// TODO Auto-generated constructor stub
}

}
